package cn.edu.jsu.official;

import org.apache.catalina.connector.Connector;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

/**
 * @author C4ptainMo
 */
@EnableWebMvc
@SpringBootApplication
public class OfficialApplication {
    public static void main(String[] args) {
        System.out.println(System.getProperty("user.dir"));
        System.out.println("操作系统为: " + System.getProperty("os.name"));
        System.out.println(String.format("本计算机的核数：%d", Runtime.getRuntime().availableProcessors()));
        SpringApplication.run(OfficialApplication.class, args);
    }

    @Bean
    public TomcatServletWebServerFactory webServerFactory() {
        TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
        factory.addConnectorCustomizers((Connector connector) -> {
            connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
            connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
        });
        return factory;
    }
}
